#include <stdio.h>

#define Max(a,b) ((a)>(b)?(a):(b))

int maxScore(int* cardPoints, int cardPointsSize, int k) {
    int sum=0,max=0;
    for( int i=0; i<k; i++ )
        sum+=cardPoints[i];
    max=Max(max,sum);
    for( int i=0; i<k; i++ ){
        sum-=cardPoints[ k-1-i ];
        sum+=cardPoints[ cardPointsSize-1-i ];
        max=Max(max,sum);
    }
    return max;
}

int main(){
    int cp[]={1,79,80,1,1,1,200,1};
    printf("%d\n",maxScore(cp,sizeof(cp)/sizeof(int),3));
    return 0;
}
